import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { createPage } from 'nc-lightapp-front';
import "./index.less"
import DataTable from '../data-table';


export default class DataTableList extends Component {

    constructor(props){
        super(props);
        this.state = {
            // 整体数据的arr
            dataArr: ["1", "2", "3"],
            // 当前活动的ID
            activeId: "1"
        },
        this.handleChangeActiveDataTableList = this.handleChangeActiveDataTableList.bind(this)
    }

    /**
     * @功能: 改变当前活跃的对象
     * @作者：Mr.sha
     * @日期：2022-05-27
     * @param {*} e 
     */
    handleChangeActiveDataTableList(params){
        this.setState({activeId: params.activeId})
    }

    render() {
        return (
            <div>
                {
                    this.state.dataArr.map((item,index) => {
                        return <DataTable key={index} item = {item} activeId = {this.state.activeId} handleChangeActiveDataTableList = {this.handleChangeActiveDataTableList}/>
                    })
                }
            </div>
        )
    }
}

DataTableList = createPage({
    mutiLangCode: '2011'
})(DataTableList);

ReactDOM.render(<DataTableList />, document.querySelector('#app'))